Skip to main content
Feedback

Creating an adapter project

This topic describes how to create an adapter project for a pre or post processor or a custom authenticator.

note

These steps are applicable up to version 6.3.0.

Creating an adapter project for pre or post processor

Procedure

  1. Run the create-adapter script to create the adapter project.

    • Linux or macOS:

      /home/user/MasheryLocalSDK$ ./create-adapter.sh --project-name MyCustomAdapter --adapter-type TrafficEventListener --adapter-name MyCustomProcessor --package-name com.companyname.apim.adapter 
    • Windows:

      C:\Users\Administrator\MasheryLocalSDK> create-adapter.bat --project-name MyCustomAdapter --adapter-type TrafficEventListener --adapter-name MyCustomProcessor --package-name com.companyname.apim.adapter
  2. Change the project name, adapter name, and package name to match your project.

    note

    The first run of the script downloads the required Gradle binaries.

  3. Open the Java source MyCustomProcessor.java in a text editor and write the pre-processing and post-processing logic.

  4. Run the migrate-adapter script to scan the project for OSGi-specific code and add the @AutoService discovery annotation:

    • Linux or macOS:

      /home/user/MasheryLocalSDK$ chmod +x migrate-adapter.sh
      /home/user/MasheryLocalSDK$ ./migrate-adapter.sh -p MyCustomAdapter
    • Windows:

      C:\Users\Administrator\MasheryLocalSDK> migrate-adapter.bat -p MyCustomAdapter

Creating an adapter project for custom authenticator

Procedure

  1. Run the create-adapter script to create the adapter project.

    • Linux or macOS:

      /home/user/MasheryLocalSDK$ ./create-adapter.sh --project-name MyCustomAdapter --adapter-type Authenticator --adapter-name MyCustomAuthenticator --package-name com.companyname.apim.adapter 
    • Windows:

      C:\Users\Administrator\MasheryLocalSDK> create-adapter.bat --project-name MyCustomAdapter --adapter-type Authenticator --adapter-name MyCustomAuthenticator --package-name com.companyname.apim.adapter
  2. Change the project name, adapter name, and package name to match your project.

    note

    The first run of the script downloads the required Gradle binaries.

  3. Open the Java source MyCustomAuthenticator.java in a text editor and implement the authenticator logic.

    For information about editing in an IDE, refer to Using the Adapter SDK in an IDE.

    For adapter examples, refer to Pre-processing Stages and Post-processing Stages.

  4. Run the migrate-adapter script to scan the project for OSGi-specific code and add the @AutoService discovery annotation:

    • Linux or macOS:

      /home/user/MasheryLocalSDK$ chmod +x migrate-adapter.sh
      /home/user/MasheryLocalSDK$ ./migrate-adapter.sh -p MyCustomAdapter
    • Windows:

      C:\Users\Administrator\MasheryLocalSDK> migrate-adapter.bat -p MyCustomAdapter
On this Page